Repository navigation
fix(executions): accept IBKR overnight fills dated to the next day - #1228
Conversation
IBKR dates fills from 20:00 ET to midnight on the following day. The broker_executions.v1 consumer required local_time to share the trade date, so one overnight fill would reject the whole execution history. Also accept a local_time on the evening before the trade date at or after 20:00; every other mismatch is still rejected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdZHqdsDyVsVxzUJLA
- Move the overnight trade-date rule into a shared module, used by both the executions store and the legacy orders/fills adapter. - Reject impossible local dates, and allow the rollover only for a null (Eastern) or America/New_York time zone. - Derive an overnight fill's executed_at from its local date. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdZHqdsDyVsVxzUJLA
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27cac39c8e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The trades table and cards showed trade_date beside the local clock, so an overnight fill booked on the next trade date looked a day late. Show the local date with the clock when it differs from the trade date. Regenerate the embedded v2 asset map. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdZHqdsDyVsVxzUJLA
|
@codex review Generated by Claude Code |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
AI assistance
Claude Code (Anthropic) made the change. Local Codex CLI (
gpt-6.2-astra, reasoning high) reviewed it in two rounds. The P1 and the P2s from round 1 are fixed; round 2 raised only P2s, which are listed under Risk.What changed
The
broker_executions.v1consumers now accept a US 23/5 overnight fill. Such a fill'slocal_timefalls on the calendar day immediately before itstrade_date, at or after 20:00, in Eastern time:application/account_facts/trade_date_boundary.jsholds the shared rulelocalTimeMatchesTradeDate(localDay, time, tradeDate, timeZone). It strictly rejects impossible dates such as2026-09-31. The rollover applies only whentime_zoneisnull(the Flex producer's Eastern assumption) orAmerica/New_York; any other explicit zone keeps the same-day rule.account_facts/executions.js(normalizeExecutions) uses the shared rule in place of the strict same-day check.orders_fills/normalize.js(adaptLegacyBrokerExecutionPayload) accepts the same shape and derivesexecuted_atfor an overnight fill from its local calendar date, not its trade date.broker_executions_validation.mjscovers the accepted boundary and Sunday→Monday cases, plus rejections for 19:59, a two-day gap, local after trade date, an impossible date and explicit non-Eastern zones.sa2_orders_fills_validation.mjschecks the adapter'sexecuted_at(2026-10-22T20:30 ET→2026-10-23T00:30:00.000Z) and its rejections.Compatibility: the change only relaxes consumers, so payloads that were valid stay valid. This PR must merge before the matching producer change in
InteractiveBrokersPlatform, which starts emitting such rows.How verified
node tests/broker_executions_validation.mjs,sa2_orders_fills_validation.mjs,sa2_demo_validation.mjs,sa2_deployable_capital_validation.mjs,account_identity_inventory_validation.mjs,console_execution_evidence_validation.mjs: PASS.node tests/read_contract_boundaries_validation.mjs: PASS.npm run test:operations --prefix web/strategy-switch-console: PASS.jscommand list fromvalidate.ymlpasses locally, except five release-history scripts that need a full-depth clone (they also fail on unchangedmainin a shallow checkout).git diff --check: clean.Why
IBKR dates US overnight fills from 20:00 ET to midnight on the following day, and the US 23/5 trading boundary takes effect on 2026-12-06. With the old strict same-day check, a single such row made the whole execution history invalid.
Risk
trade_datebeside the local clock time, so an overnight fill appears on its booking date (frontend);US/Eastern;Generated by Claude Code